<template>
  <div class="d-flex">
    <el-popover placement="right" trigger="hover">
      <el-image style="width: 400px; height: 300px;" :src="row.imgUrl" fit="cover">
        <img class="full" slot="error" :src="require('@/assets/images/empty_house.png')" />
      </el-image>
      <div class="list-img pointer" slot="reference">
        <el-image class="full" :src="row.imgUrl" fit="cover" @click="handleClickTag('TAB_IMG')">
          <img class="full" slot="error" :src="require('@/assets/images/empty_house.png')" />
        </el-image>
        <div class="list-img-icon">
          <div class="icon-box" v-if="row.houSubTypeState === '10'" @click="handleClickTag('TAB_VR')">
            <i class="iconfont iconvr fs24"></i>
          </div>
          <div class="icon-box" v-if="row.videoMaterial === '1'" @click="handleClickTag('TAB_VIDEO')">
            <i class="iconfont iconshipin fs24"></i>
          </div>
        </div>
      </div>
    </el-popover>
    <div class="flex-1 ml20 oh">
      <div class="ellipsis text-blue pointer" :title="row.resblockName" @click="handleClickTitle">
        {{ row.resblockName }}
      </div>
      <div>
        <span>{{ row.room | empty }}室{{ row.hall | empty }}厅</span>
        <span v-html="'\u00a0|\u00a0'"></span>
        <span>{{ row.buildSize | empty }}㎡</span>
        <span v-html="'\u00a0|\u00a0'"></span>
        <span class="text-red">{{ row.totalPrices | priceFormat }}万</span>
      </div>
      <div class="ellipsis" :title="row.title">{{ row.title }}</div>
      <div>
        <el-button class="list-tag" type="primary" size="mini" @click="handleClickTag('TAB_IMG')">
          <span>图片</span>
          <span>({{ row.shiNeiTuCount || 0 }})</span>
        </el-button>

        <el-button
          class="list-tag"
          type="danger"
          size="mini"
          v-if="row.houSubTypeState === '10' || row.houSubTypeState === '1'"
          :loading="row.houSubTypeState === '1'"
          @click="handleClickTag('TAB_VR')"
        >
          VR
        </el-button>

        <el-button
          class="list-tag"
          type="warning"
          size="mini"
          v-if="row.videoMaterial === '1' || row.videoStatus === '1'"
          :loading="row.videoStatus === '1'"
          @click="handleClickTag('TAB_VIDEO')"
        >
          视频
        </el-button>
        
        <el-button
          class="list-tag"
          type="success"
          size="mini"
          v-if="row.spherePanoramaMaterial === '1' || row.sphereStatus === '1'"
          :loading="row.sphereStatus === '1'"
        >
          全景图
        </el-button>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  name: 'HouseListItemBase',

  components: {},

  filters: {
    priceFormat: function(value) {
      if (!value) return '--';
      return value / 10000;
    }
  },

  props: {
    row: {
      type: Object,
      default() {
        return {};
      }
    }
  },

  data() {
    return {};
  },

  computed: {},

  watch: {},

  beforeMount() {},

  mounted() {},

  methods: {
    handleClickTag(e) {
      const { id } = this.row;
      this.$emit('clickTag', { delId: id, tab: e });
    },
    handleClickTitle() {
      const { id } = this.row;
      this.$emit('clickTitle', id);
    }
  }
};
</script>
<style lang="scss" scoped>
.list-img {
  position: relative;
  width: 120px;
  height: 90px;
}

.list-img-icon {
  position: absolute;
  left: 0;
  bottom: 4px;
  display: flex;

  .icon-box {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-left: 6px;
    border-radius: 999px;
    width: 22px;
    height: 22px;
    color: #fff;
    opacity: 0.5;
    background-color: rgba(0, 0, 0, 1);
  }
}

.list-tag {
  padding: 2px 6px;
}
</style>
